# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit unpacker xdg

VERSION="$(ver_cut 1).$(ver_cut 2).$(ver_cut 3)"

DESCRIPTION="Baidu Net Disk is a cloud storage client (Linux Version)"
HOMEPAGE="https://pan.baidu.com"
SRC_URI="http://issuecdn.baidupcs.com/issue/netdisk/LinuxGuanjia/${VERSION}/${PN}_linux_${PV}.deb"

LICENSE=""
SLOT="0"
RESTRICT="strip"
KEYWORDS="~amd64"
IUSE=""

DEPEND="
	x11-libs/gtk+
	x11-libs/libXScrnSaver
	dev-libs/nss
"
RDEPEND="${DEPEND}"
BDEPEND=""

S="${WORKDIR}"

PATCHES=(
	"${FILESDIR}/${P}-fix.patch"
)

src_install() {
	mv usr/share/doc/{${PN},${PF}} || die
	gzip -d usr/share/doc/${PF}/*.gz || die

	exeinto /usr/bin
	newexe ${FILESDIR}/${PN} ${PN}

	insinto /usr
	doins -r ${S}/usr/share

	insinto /opt
	doins -r ${S}/opt/${PN}
	fperms +x /opt/${PN}/${PN}
}
